﻿function Login() {
    
    username = $("#username").val()
    password = $("#password").val()
    var model = JSON.stringify({
        "systemCode": "433066df-f260-4267-baf9-bd381deadc0b",
        "username": username,
        "password": password
    })

    localStorage.clear();
    $.ajax({
        url: "../User/UserDo",
        type: "post",
        data: { model: model },
        // contentType: "application/json",
        success: function (res) {
            var ressult = JSON.parse(res)
            if (ressult.code == 200) {
                localStorage.setItem("token", ressult.data)
                var token = localStorage.getItem("token")
                $.ajax({
                    url: "../User/GetUserName",
                    type: "get",
                    data: { token: token },
                    success: function (rest) {
                        console.log(rest)
                        var ressults = JSON.parse(rest)
                        if (ressults.code == 0) {
                            //用户名称
                            // localStorage.removeItem("UserName")
                            debugger;
                            console.log(ressults.data)
                            localStorage.setItem("UserName", ressults.data)
                        }
                    }
                })


               window.location.href = "/Carrier/GetCarrier"
            }
            else {
                alert(ressult.message)
            }

        }



    })

}

function LoginAdd() {

    window.location.href = "/User/UserAdd"

}